package com.tt.dp.observer.observer;

import com.tt.dp.observer.subject.Subject;

public class StatisticsDisplay implements Observer,DisplayElement{

    private float temp;

    private float humidity;

    private float pressure;

    private Subject weatherData;

    public StatisticsDisplay(Subject weatherData){
        this.weatherData = weatherData;
        weatherData.registerObserver(this);
    }

    public void display() {
        System.out.println("i'm statisticsDisplay data update temp: " + temp + " , pressure: " + pressure + " , humidity: " + humidity + " ");
    }

    public void update(float temp, float humidity, float pressure) {
        this.temp = temp;
        this.humidity = humidity;
        this.pressure = pressure;
        display();
    }
}
